﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CGrass : MonoBehaviour
{
	public int grassId;
	private void Awake()
	{
		int.TryParse(name, out grassId);
	}
	private void OnTriggerEnter(Collider other)
	{
		CEntity e = other.gameObject.GetComponentInParent<CEntity>();
		if (e == null) return;
		e.SetGrass(grassId,true);
	}
	private void OnTriggerExit(Collider other)
	{
		CEntity e = other.gameObject.GetComponentInParent<CEntity>();
		if (e == null) return;
		e.SetGrass(grassId, false);
	}
}
